package utils

import (
	"fmt"
	"gopkg.in/ini.v1"
)

var (
	AppMode  string
	SiteName string
	HttpPort string
	DbHost   string
	DbPort   string
	DbUser   string
	DbPass   string
	DbData   string
)

func Init() {
	File, error := ini.Load("./config/config.ini")
	if error != nil {
		fmt.Println("载入配置文件失败!")
		return
	}
	AppMode = File.Section("server").Key("AppMode").MustString("Debug")
	SiteName = File.Section("server").Key("SiteName").MustString("142x.com")
	HttpPort = File.Section("server").Key("HttpPort").MustString("4556")
	DbHost = File.Section("database").Key("DbHost").MustString("localhost")
	DbPort = File.Section("database").Key("DbPort").MustString("3306")
	DbUser = File.Section("database").Key("DbUser").MustString("root")
	DbPass = File.Section("database").Key("DbPass").MustString("root")
	DbData = File.Section("database").Key("DbData").MustString("dwcms")
}
